class Post
  include Mongoid::Document
  include Mongoid::Timestamps

  field :body, type: String

  belongs_to :user, index: true
  has_and_belongs_to_many :tags, index: true
  has_and_belongs_to_many :user_mentions, :class_name => "User"

  index({ created_at: -1 }, {})

  validates_presence_of :body, :user
  validates_length_of :body, maximum: 140
end